package com.fay.designPattern.principles.solid;

import java.util.Map;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/3/2 15:15
 * @Version 1.0
 */
public class RedisConfig implements Updater,Viewer {

    private ConfigSource configSource;// 配置中心（比如zk）
    private String address;
    private int timeout;
    private int maxTotal;

    // 省略其它配置：maxWaitMillis，maxIdle，minIdle


    public RedisConfig(ConfigSource configSource) {
        this.configSource = configSource;
    }

    public String getAddress() {
        return address;
    }

    @Override
    public void update() {
        // 从configSource加载配置到address/timeout/maxTotal...
    }

    @Override
    public String outputInPlainText() {
        return null;
    }

    @Override
    public Map<String, String> output() {
        return null;
    }
}
